﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CapaGestion;
using CapaGestion.Spring;
using CRUD.DAO;
using CapaNegocios;
using GestionadorBaseDatos;


public partial class InterfazKamalde_AgregarParticipante : Base
{
    IGestionParticipante gestionarParticipante = AdministradorGestion.getGestionarParticipante();

    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            IList categorias = gestionarParticipante.GetCategorias();
            foreach (Categoria cat in categorias)
            {
                categ.Items.Add(cat.Nombre);
            }
        }
        else
        {
            mensaje.alert("Participante Incluido");
            
        }
    }

    public void InsertarParticipante(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(3000);
        Participante part = new Participante();
        part.Nombre = nParticipante.Text;
        part.Proporcion =  int.Parse(proporcion.Text);
        Categoria cat = new Categoria();
        cat.IdCategoria = categ.SelectedIndex;
        part.CategoriaFk = cat;
        gestionarParticipante.Insert(part);
    }
}
